#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include "server.h"
#include "captcha.h"
#include <QFile>

QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT
public:
    Widget(QWidget *parent = nullptr);
    ~Widget();
    QString getMsg();

private:
    Ui::Widget * ui;
    QTcpServer * tcpServer;
    captcha * one = new captcha();
    int num = 0;
    QString time;
    QList <QTcpSocket *> socketList;

    QFile *file;
    QString fileName;
    qint64 max = 20 * 1024;
    qint64 fileSize;
    qint64 sendSize;
    qint64 recvSize;
    QString path;
    bool isFile;
    bool underline = false;
    bool bold = false;
    bool italic = false;

private slots:
    void mNewConnetion();
    void receiveMessages();
    void mStateChanged(QAbstractSocket::SocketState);
    void on_pushButton_clicked();
    void on_startButton_clicked();
    void on_stopButton_clicked();
    void on_chooseButton_clicked();
    void on_sendfileButton_clicked();
    void sendFileData(QTcpSocket *tTcpSocket);

    void on_underlineTbtn_clicked();
    void on_boldBtn_clicked();
    void on_clearTbtn_clicked();
    void on_colorTbtn_clicked();
    void on_italicTbtn_clicked();
    void on_saveTbtn_clicked();
    void on_fontcbx_currentFontChanged();
    void on_sizeCbx_currentTextChanged();
};
#endif // WIDGET_H
